//
//  ViewController.m
//  UI06_UIScrollView_相册
//
//  Created by wyx on 16/3/16.
//  Copyright © 2016年 Apon. All rights reserved.
//

#import "ViewController.h"
#import "MyScorllView.h"
#import "Album.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    //[self createScorllView];
    [self createAlbum];
    
}
#pragma mark - Date
- (NSArray *)handleDate {
    NSMutableArray *mArr = [NSMutableArray array];
    for (int i = 0; i < 4; i++) {
        NSString *name = [NSString stringWithFormat:@"Zombie%d.tiff",i];
        UIImage *image = [UIImage imageNamed:name];
        [mArr addObject:image];
    }
    return mArr;
}

#pragma mark - 知识点1: UIScrollView
- (void)createScorllView {
    
    NSArray *image = [self handleDate];
    
    MyScorllView *scorll = [[MyScorllView alloc] initWithFrame:CGRectMake(0, 0, 300, 400) withImage:image];
    [self.view addSubview:scorll];
    [scorll release];
}
#pragma mark - 知识点2: 相册(scrollView结合 PageControl来使用)
- (void)createAlbum {
    Album *album = [[Album alloc] initWithFrame:CGRectMake(0, 0, 300, 400) withImage:[self handleDate]];
    album.center = self.view.center;
    [self.view addSubview:album];
    [album release];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
